package com.wgts.wgts.mvp.presenter.imp;

import com.wgts.wgts.mvp.model.ISystemSettingActivityModel;
import com.wgts.wgts.mvp.presenter.ISystemSettingActivityPresenter;
import com.wgts.wgts.mvp.view.ISystemSettingActivityView;
import com.wgts.wgts.netmodle.HttpResultSubscriber;
import com.wgts.wgts.netmodle.resp.AppUpdateEntity;
import com.wgts.wgts.rxjava.MVPResultSubscriber;

/*
 *
 *   data:2018/10/610:18
 *
 */public class SystemSettingActivityPresenter implements ISystemSettingActivityPresenter {
     private ISystemSettingActivityView view;
     private ISystemSettingActivityModel model;

    public SystemSettingActivityPresenter(ISystemSettingActivityView view, ISystemSettingActivityModel model) {
        this.view = view;
        this.model = model;
    }

    @Override
    public void quitLogin() {
        model.quitLogin(new MVPResultSubscriber<String>() {
            @Override
            public void netx(String s) {
                view.quitLogin();
            }
        });
    }

    @Override
    public void appUpdate(String channel, String version) {
        model.appUpdate(channel, version, new HttpResultSubscriber<AppUpdateEntity>() {
            @Override
            public void onSuccess(AppUpdateEntity appUpdateEntity) {
                view.appUpdate(appUpdateEntity);
            }

            @Override
            public void _onError(int status, String msg) {
                view.onError(status, msg);
            }
        });
    }
}
